package sk.octopuss.archery.dao;

import java.util.List;

public interface GenericDao<T> {
	/**
     * Find an entity by its primary key
     *
     * @param id the primary key
     * @return the entity
     */
	public abstract T find(Long id);
	
	/**
     * Load all entities.
     *
     * @return the list of entities
     */
	public abstract List<T> findAll();
	
	 /**
     * Count all entities.
     *
     * @return the number of entities
     */
	public long countAll();
	
	
	/**
     * save an entity. This can be either a INSERT or UPDATE in the database.
     * 
     * @param entity the entity to save
     * 
     * @return the saved entity \@ID
     */
    public long save(final T entity);
    
    /**
     * delete an entity from the database.
     * 
     * @param entity the entity to delete
     */
    public void delete(final T entity);
}
